/*
 * Copyright (c) 2023 IUV Inc. All rights reserved.
 * 项目名称：IUV TXY
 * 文件名：RespondUtil.java
 * Date：23-10-10 下午2:09
 * Author：Will
 */

package com.iuv.baike.util;

import com.iuv.baike.common.CommonOperateCode;

import java.util.HashMap;
import java.util.Map;

/**
 * RespondUtil
 * 请求返回组装工具类
 *
 * @author Will
 * @date 15:57
 */
public class RespondUtil {
    /**
     * 返回成功响应
     *
     * @param sysCode
     * @param sysMsg
     * @return
     */
    public static Map<String, Object> respondSuccess(String sysCode, String sysMsg) {
        return respond(CommonOperateCode.HandleStatus.SUCCESS, sysCode, sysMsg);
    }

    /**
     * 返回失败响应
     *
     * @param sysCode
     * @param sysMsg
     * @return
     */
    public static Map<String, Object> respondFail(String sysCode, String sysMsg) {
        return respond(CommonOperateCode.HandleStatus.FAILURE, sysCode, sysMsg);
    }

    private static Map<String, Object> respond(String status, String sysCode, String sysMsg) {
        Map<String, Object> result = new HashMap<String, Object>();
        result.put("status", status);
        result.put("sysCode", sysCode);
        result.put("sysMsg", sysMsg);
        return result;
    }
}
